#include "TaskDispatcher.h"



TaskDispatcher* TaskDispatcher::m_instance;
TaskDispatcher::TaskDispatcher()
{   
}

TaskDispatcher::~TaskDispatcher()
{  
}

static TaskDispatcher* getInstance()
{
    if (m_instance==nullptr)
    {
        m_instance = new TaskDispatcher;
    }
    return m_instance;
}

void TaskDispatcher::addTask(Msg *msg)
{
    m_mtx.lock();
    m_taskQue.push_back(msg);
    m_mtx.unlock();
}

void TaskDispatcher::getTask(std::deque<Msg*> &taskQue)
{
    m_mtx.lock();
    m_taskQue.swap(taskQue);
    m_mtx.unlock();
}
